import 'package:flutter/material.dart';
import 'firstPage.dart';
import 'secondPage.dart';
import 'thirdPage.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyApp>
    with SingleTickerProviderStateMixin {
  TabController controller;

  @override
  void initState() {
    controller = new TabController(length: 3, vsync: this);
    super.initState();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: TabBarView(
        controller: controller,
        children: <Widget>[FirstPage(), SecondPage(), ThirdPage()],
      ),
      bottomNavigationBar: Material(
        color: Colors.orangeAccent,
        child: TabBar(
          controller: controller,
          tabs: <Widget>[
            Tab(
              text: "列表",
              icon: Icon(Icons.home),
            ),
            Tab(
              text: "通知",
              icon: Icon(Icons.message),
            ),
            Tab(
              text: "我的",
              icon: Icon(Icons.person),
            )
          ],
        ),
      ),
    );
  }
}
